Field of the Invention
The present invention relates to an imaging apparatus and a method for controlling the imaging apparatus. More particularly, the present invention relates to an imaging apparatus that detects a face of an object using an image signal output from an image sensor when a person is shot as the object, and also relates to a method of controlling the imaging apparatus.
Description of the Related Art
Conventionally, an autofocus (AF) camera of the phase-difference detection type having a plurality of focus detection points performs focal position detection at each of the plurality of focus detection points in a field. Then, the AF camera performs control to focus on a focus detection point that is automatically or intentionally selected from among the focus detection points. In the automatic focus detection point selection, a general camera selects and focuses on a focus detection point having the shortest distance to an object based on the focus detection results at the focus detection points.
Furthermore, there are AF cameras of the contrast type, which captures an object image formed by an imaging lens using an image sensor and determines an in-focus position using an image signal obtained from a focus area. The camera of the contrast type performs focusing on a focal position having a peak focus evaluation value in the focus area.
In AF cameras of the contrast type, a camera that detects a region of a face of a person and focuses on the face is known. Regarding the face detection method, Japanese Patent Application Laid-Open No. 8-63597 discusses a method for determining a face candidate region corresponding to the shape of a face of a person and determining a face region based on feature information of the face candidate region. Further, Japanese Patent Application Laid-Open No. 8-63597 discusses a method for detecting a face candidate region by extracting an outline of a face of a person from an image and a method for calculating a correlation value between a plurality of templates of various shapes of faces and detecting a face candidate region based on the correlation value.
However, in the above-described AF focus detection methods, it is difficult to perform focusing under a condition where the depth of field becomes shallow with a camera to which a lens having a long focal length is mounted. For example, when a plurality of persons exist at different distances, a main object, on which a photographer intends to focus, does not always exist within the depth of field. In such a case, it is difficult to focus on the main object.
In a camera of the phase-difference detection type, when control is automatically performed to focus on a focus detection point from among a plurality of focus detection points, if an unexpected object exists near the focus detection point, the unexpected object may be focused. Accordingly, in the camera of the phase-difference detection type, it is difficult to focus on a main object a photographer intends to shoot.
Moreover, in the camera of the contrast type, focusing is performed such that an object having a maximum peak contrast is to be focused. Accordingly, for example, when a peak of the contrast of a background is larger than that of a main object, the background may be focused. Further, for example, when a peak of the contrast of clothes is larger than that of the face of the object, the clothes may be focused. As described above, in a camera of the contrast type, the position of focus to be detected is unstable, and it is difficult to focus on a point a photographer intends to focus.
In a camera of the face detection type that detects a face of an object and focus on the face, it is possible to detect a face of an object existing within the depth of field. However, if a main object does not exist within the depth of field, it is difficult to find the main object.
To solve the drawbacks described above, Japanese Patent Application Laid-Open No. 2006-345254 discusses a method for detecting faces of a plurality of objects and grouping the faces based on shooting parameters, such as object distances and object luminance values of the faces. In the method discussed in Japanese Patent Application Laid-Open No. 2006-345254, by setting optimum shooting parameters for each group, it is possible to perform shooting with the optimum shooting parameters for each object.
However, under a condition where the depth of field of a camera is shallow, if a plurality of persons exist at different distances, it is difficult to focus on a main object a photographer intends to focus.
When a main object does not exist within the depth of field at the current focal position, it is necessary to focus on the main object within the depth of field at another focal position by driving a focusing lens. In such a case, if a camera of the phase-difference detection type is used, a closest object is focused. If a camera of the contrast type is used, a point having the highest peak of contrast is focused. However, in both cases, the focused points are not always a main object.
There is a method for detecting faces of a plurality of objects, grouping the faces based on shooting parameters, such as object distances and object luminance values of the faces, setting shooting parameters optimum for each group, and performing shooting. In the method, with a single release operation, shooting is performed at a plurality of focal points where the faces of the objects are detected. Accordingly, it is possible to perform shooting on a plurality of persons within an image plane.
In the method described above, an image of the well focused main object can be recorded. However, it is necessary to record the other images. Accordingly, unnecessary images are recorded, and it takes a lot of time to organize the shot images. Further, in this method, when a plurality of persons exist within an image plane, it is not possible to record an image with only a main object focused.